package org.jdpf.core.paramserializer;

import java.util.Dictionary;
import java.util.Properties;

import org.jdpf.core.kernel.plugins.IPluginsFrameworkConstants;
import org.jdpf.core.paramserializer.services.IParamSerializer;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

public class ParamSerializerActivator implements BundleActivator {

	private ServiceRegistration registration;

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		IParamSerializer xmlSerializer=new ParamSerializer();
		Dictionary prop=new Properties();
		prop.put(IPluginsFrameworkConstants.CATEGORY, "XMLParamSerializer");
		
		registration=context.registerService(ParamSerializer.class.getName(),
								xmlSerializer, prop);
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		registration.unregister();
	}

}
